﻿<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ include file="/inc.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>闪耀先生系列 - 填写信息</title>
<meta name="keywords" content="闪耀先生 私家裁缝旗下年轻定制品牌 时尚与商务的平衡大师；有故事的男人选择私家裁缝" />
<meta name="description" content="闪耀先生 私家裁缝旗下年轻定制品牌 时尚与商务的平衡大师；有故事的男人选择私家裁缝" />
<!-- Bootstrap -->
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="<%=basePath%>css/font-awesome.min.css" />
<!-- style -->
<link href="<%=basePath%>css/home.css" rel="stylesheet" />
</head>
<body>
	<div class="alert alert-danger" role="alert" id="error"
		style="display: none">
		<i class="fa fa-exclamation-triangle"></i>22
	</div>
	<form class="form-horizontal" id="form"
		action="<%=basePath%>public/stlyeAction!go.action" method="post"
		encType="multipart/form-data">
		<s:hidden name="brand_id"></s:hidden>
		<s:hidden name="stlye_id"></s:hidden>
		<s:hidden name="btn_id"></s:hidden>
		<s:hidden name="sign"></s:hidden>
		<s:hidden name="cloth_id"></s:hidden>
		<s:hidden name="images1"></s:hidden>
		<s:hidden name="images2"></s:hidden>
		<div class="container-fluid">
			<div class="wrap graybg">
				<s:if test='error != null'>
					<div class="error">
						<div class="alert alert-danger" role="alert">
							<i class="fa fa-exclamation-triangle"></i>
							<s:property value="error" />
						</div>
					</div>
					<!--E .error-->
				</s:if>

				<!--<div class="order-list" style="padding-top: 10px;">
					<div class="row">
						<div class="col-xs-3">
							<img src="<%=basePath_org%><s:property value="brandVip.img" />" />
						</div>
						<div class="col-xs-9">
							<div class="name">${brandVip.name }</div>
						</div>
					</div>
				</div>
				E .order-list-->



				

				<div class="clearfix"></div>
				<div class="style">
					<h4>选择款式</h4>
					<div class="row" id="style_div">
						<s:iterator value="page.elements" status="stat">
							<div class="col-xs-4">
								<a href="javascript:void(0);"
									onclick="selected_style('<s:property value="id" />')"><img
									src="<%=basePath_org%><s:property value="img" />" alt="" /> </a>
							</div>
							<!--选中状态在-->
						</s:iterator>
					</div>
				</div>
				<!--E .style-->

 <div class="dizhi">
          <h3 style="margin-top:0;">完善会员信息</h3>
          <div class="form-group has-error">
          <s:textfield id="name" name="name" cssClass="form-control"
							placeholder="收货人" />
          </div>
          <div class="form-group has-error">
            <s:textfield id="address" name="address" cssClass="form-control"
							placeholder="收货地址" />
          </div>
          <div class="form-group has-error">
           <s:textfield id="phone" name="phone" cssClass="form-control"
							placeholder="手机号" />
          </div>
        </div><!--E .dizhi-->
        
        
				<s:if test="brandVip.fd4sm == '10'">
					<div class="checkbox" style='display:none'>
						<label> <s:checkbox id="fd4sm" name="fd4sm" value="true" />
							是否使用上门券
						</label>
					</div>
				</s:if>
				<s:if test="brandVip.fd4cs == '10'">
					<div class="checkbox">
						<label> <s:checkbox id="fd4cs" name="fd4cs" value="true" />
							是否使用衬衫券
						</label>
						<p>可使用衬衫券进行抵扣</p>
					</div>
				</s:if>
				
					<div class="checkbox">
						<label> 
						<s:checkbox id="call" name="call" value="true" />
						
							选择预付10%，客服与你沟通确认后再付清全款；预付款随时可退。
						</label>
					</div>
				<div>
					<button type="button" onclick="go('3')"
						class="btn btn-org btn-lg btn-block">
						马上定制</button>
				</div>
				<!--E .wrap-->

			</div>
		</div>
	</form>



	<script src="<%=basePath%>js/jquery-1.10.1.min.js"></script>
	<script src="<%=basePath%>js/bootstrap.min.js"></script>
	<script src="<%=basePath%>js/detail.js"></script>
	<script type="text/javascript">
	$("#call").click();
	//	$('#myModal,myModal1').modal(options);
	</script>
	<script>
	function checkOrder(){
		var fd4sm_b = $('input[name="fd4sm"]:checked ').val();
		var fd4sm = "00";
		if(fd4sm_b){
			fd4sm= "10";
		}
		
		var openid = "${openId}";
		$.ajax({
			type:'post',
			async:false,
			url:'<%=basePath%>public/orderAction!checkOrder.action',
			dataType : 'json', 
			data : {"fd4sm":fd4sm,"openid":openid},
			timeout:60000,
			success: function (json_str){
				var temp = eval(json_str); 
				if(temp.code != "success"){
					var errorDiv = document.getElementById("error");
			       	errorDiv.style.display = "none";
					document.getElementById('error').innerHTML=temp.message;
		       		errorDiv.style.display = "block";
					var t = $('#error').offset().top;
					$(window).scrollTop(t);
					//alert(temp.message);
					return true;
				}else{
					//alert(temp.message);
					if(checkForm()){
						$('#form').submit();
					}
					//return false;
				}
				
			}
		});
	}	
	
		function checkForm() {
		  var errorDiv = document.getElementById("error");
       	 errorDiv.style.display = "none";
       	 var name = document.getElementById('name').value;
       	 if(!name) {//a为null 或者"" 或者0 
       		 document.getElementById('error').innerHTML='请输入收货人';
       		 errorDiv.style.display = "block";
       		 return;
       	}
       	 var address = document.getElementById('address').value;
       	 if(!address) {//a为null 或者"" 或者0 
       		 document.getElementById('error').innerHTML='请输收货地址';
       		 errorDiv.style.display = "block";
       		 return;
       	}
       	 var phone = document.getElementById('phone').value;
       	 if(!phone) {//a为null 或者"" 或者0 
       		 document.getElementById('error').innerHTML='请输手机号';
       		 errorDiv.style.display = "block";
       		 return;
       	}
			/* if($("#height").val() != "身高"){
				
			}else{
				$('#error').css("display","none");
				$('#error').text("请选择身高!");
				$('#error').css("display","block");
				 return false;
			}
			
			if($("#weight").val() != "体重"){
				
			}else{
				$('#error').css("display","none");
				$('#error').text("请选择体重!");
				$('#error').css("display","block");
				 return false;
			}
			
			if($("#size").val() != "常穿型号" && $("#size").val() != "CS" && $("#size").val() != "XZ"){
				
			}else{
				$('#error').css("display","none");
				$('#error').text("请选择常穿型号!");
				$('#error').css("display","block");
				 return false;
			}
			
			  var selFlag = false;
			  $("input[type='checkbox']").each(function(){
			  	var sel = $(this).attr("name");
			  	if(document.getElementById(sel).checked == true){
			  		selFlag = true;
			  	}
			 });
			 if(selFlag){
			 
			 }else{
				$('#error').css("display","none");
				$('#error').text("预付500为必填!");
				$('#error').css("display","block");
				 return false;
			 }
			
			var style_div = $('#style_div').find("a[class='active']").length;
			if(style_div > 0){
			
			}else{
				$('#error').css("display","none");
				$('#error').text("请选择款式!");
				$('#error').css("display","block");
			     return false;
			}
			
			var button_div = $('#button_div').find("a[class='active']").length;
			if(button_div > 0){
			
			}else{
				$('#error').css("display","none");
				$('#error').text("请选择纽扣!");
				$('#error').css("display","block");
			     return false;
			}  */
       		//checkOrder();
			return true;
		}

		function go(sign) {
			$('#sign').val(sign);
			if (sign == '3') {
				checkOrder();
				/* if (checkForm()) {
					$('#form').submit();
				} else {
					var t = $('#error').offset().top;
					$(window).scrollTop(t);
				} */
				
			} else {
				$('#form').submit();
			}

		}

		function selected_style(value) {
			$('#stlye_id').val(value);
		}

		function selected_btn(value) {
			$('#btn_id').val(value);
		}
	
		$(document).ready(function() {
			//$("#trade_in").bind("click",_wxCall);
			$("#call").click();
			$("#style_div div a").first().click();
			$("#button_div div a").first().click();
		});
		
	</script>


</body>
</html>